package com.ytd.smartcanteen.weighting.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.ytd.smartcanteen.weighting.bean.MealTimeInfo;

import java.util.List;

/**
 * 餐别表
 *
 * @author gaoguanchao
 * @since 2023/3/24
 */
@Dao
public interface MealTimeInfoDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(MealTimeInfo mealInfo);

    @Update
    void update(MealTimeInfo mealInfo);

    @Delete
    void delete(MealTimeInfo mealInfo);

    @Query("DELETE FROM mealtimeinfo")
    void deleteAll();

    @Query("SELECT * FROM mealtimeinfo")
    List<MealTimeInfo> getAll();

    @Query("SELECT * FROM mealtimeinfo WHERE mealTimeId =:mealTimeId")
    MealTimeInfo getMealTimeForId(String mealTimeId);

    @Query("SELECT count(*) FROM mealtimeinfo")
    int getCount();

}
